package org.osll.tictactoe.transport.rmi.server;

import java.rmi.RemoteException;

import org.osll.tictactoe.CurrentMove;
import org.osll.tictactoe.Move;
import org.osll.tictactoe.Size;
import org.osll.tictactoe.Team;
import org.osll.tictactoe.game.Game;
import org.osll.tictactoe.transport.rmi.Control;

public class ControlImpl implements Control {

	private Game controller = null;
	
	public ControlImpl(Game controller) {
		this.controller = controller;
	}

	@Override
	public void disconnect() throws RemoteException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Move getApponentMove(Team team) throws RemoteException {
		return controller.getLastMove(team);
	}

	@Override
	public String getApponentName(Team team) throws RemoteException {
		return controller.getApponentName(team);
	}

	@Override
	public CurrentMove getMoveEndTime() throws RemoteException {
		return controller.getCurrentMove();
	}

	@Override
	public Size getSize() throws RemoteException {
		return controller.getField().getSize();
	}

	@Override
	public boolean isOver() throws RemoteException {
		return controller.isOver();
	}

	@Override
	public boolean isStarted() throws RemoteException {
		return controller.isStarted();
	}

	@Override
	public void loginUser(String user, Team team) throws RemoteException {
		controller.loginPlayer(user, team);
		
	}

	@Override
	public void makeMove(Move move) throws RemoteException {
		controller.makeMove(move);
		
	}
	
}
